#ifndef LABELLISTMODEL_H
#define LABELLISTMODEL_H
#include <QAbstractListModel>
#include <QVector>
#include "polygonitem.h"
#include "labelnamelistmodel.h"
struct SceneItemData {
    PolygonItem *item;
    QString text;
    bool visible;
};
class LabelListModel: public QAbstractListModel
{
    Q_OBJECT
public:

    LabelListModel(QObject *parent = nullptr);

    int rowCount(const QModelIndex &parent = QModelIndex()) const override;
    QVariant data(const QModelIndex &index, int role) const override;
    bool setData(const QModelIndex &index, const QVariant &value, int role) override;
    Qt::ItemFlags flags(const QModelIndex &index) const override;

    void addItem(PolygonItem *item, const QString &text);
    void removeItem(PolygonItem *item);
    int indexOf(PolygonItem *item) const;

    void setLabelNameList(LabelNameListModel *labelModel);
    void clear();
private:
    QVector<SceneItemData> myItems;
    LabelNameListModel *myLabelModel = nullptr;
};

#endif // LABELLISTMODEL_H
